﻿using Yto.Entities;
using Yto.Entities.Record;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yto.Core.Users
{
    public abstract class User<T> : UserBase, IFull<T>, IActive
        where T : User<T>
    {
        public const int MAXPWDLENGTH = 32;

        [Required]
        [StringLength(MAXPWDLENGTH)]
        [Column("PASSWORD")]
        public virtual string Password { get; set; }

        [Required]
        [Column("NAME")]
        public virtual string Name { get; set; }

        public virtual T Creator { get; set; }

        public virtual T Modifier { get; set; }

        public virtual T Deleter { get; set; }

        [Column("ISACTIVE")]
        public virtual bool IsActive { get; set; }

        protected User()
        {
            IsActive = true;
        }
    }
}
